{
  "tasks": {
    "task": [
    {{foreach from=$tasks item=task name=fetasks}}
      {
        "id": "{{$task.id}}",
        "title": "{{$task.name}}",
        "author": "{{$task.author}}",
        "images": "{{$task.images}}",
        "date": "{{$task.date}}",
        "finish_date": "{{$task.finish_date}}",
        "finish_date_left": "{{$task.finish_date_left}}",
        "dateago": "{{$task.dateago}}",
        "desc": "{{$task.desc}}",
        "important": "{{$task.important}}",
        "tasktype": "{{$task.tasktype}}",
        "order": "{{$task.order_id}}",
        "state": "{{$task.status}}",
        "reported": "{{$task.reported}}",
        "state_date": "{{$task.status_date}}",
        "users": "{{foreach from=$task.users item=user name=usersloop}}{{$user}}{{if !$smarty.foreach.usersloop.last}}|{{/if}}{{/foreach}}",
        "userimages": "{{foreach from=$task.img_users item=img_user name=img_usersloop}}{{$img_user}}{{if !$smarty.foreach.img_usersloop.last}}|{{/if}}{{/foreach}}",
        "userid": "{{foreach from=$task.id_users item=id_user name=id_usersloop}}{{$id_user}}{{if !$smarty.foreach.id_usersloop.last}}|{{/if}}{{/foreach}}",
        "fbuid": "{{foreach from=$task.fb_users item=fb_user name=id_usersloop}}{{$fb_user}}{{if !$smarty.foreach.id_usersloop.last}}|{{/if}}{{/foreach}}",
        "totaltaskscount": "{{foreach from=$task.totaltaskscount item=taskcount name=count_usersloop}}{{$taskcount}}{{if !$smarty.foreach.count_usersloop.last}}|{{/if}}{{/foreach}}",
        "todaydonetaskscount": "{{foreach from=$task.todaydonetaskscount item=taskcount name=count_usersloop}}{{$taskcount}}{{if !$smarty.foreach.count_usersloop.last}}|{{/if}}{{/foreach}}",
        "ownerid": "{{$task.owner.userid}}",
        "ownerfbuid": "{{$task.owner.fbuid}}",
        "ownertotaltaskscount": "{{$task.owner.totaltaskscount}}",
        "ownertotaldonetaskscount": "{{$task.owner.totaldonetaskscount}}",
       	{{if $task.projects}} "projects": "{{foreach from=$task.projects item=project name=projectsloop}}{{$project}}{{if !$smarty.foreach.projectsloop.last}}, {{/if}}{{/foreach}}",{{/if}}
      	{{if $task.projects}}"projectids": "{{foreach from=$task.projects key=projectid item=project name=projectsloop}}{{$projectid}}{{if !$smarty.foreach.projectsloop.last}}, {{/if}}{{/foreach}}",{{/if}}
        "pointTypeID": "{{$task.pointTypeID}}",
        "point": "{{$task.point}}",
        "daily": "{{$task.daily}}"
      }
      {{if $smarty.foreach.fetasks.last}} {{else}},{{/if}}
      {{/foreach}}
    ]
  }
}